/*
 * @Author: gonglf 457423258@qq.com
 * @Date: 2022-06-11 17:01:58
 * @LastEditors: gonglf
 * @LastEditTime: 2022-09-23 10:30:54
 * @FilePath: /consumer-demo/worker.go
 * @Description:
 *
 * Copyright (c) 2022 by gonglf 457423258@qq.com, All Rights Reserved.
 */
package consumer

import "context"

//微服务模式下，需要用协程start
var (
	ctx    context.Context
	cancel context.CancelFunc
)

func OnStart() {
	ctx, cancel = context.WithCancel(context.Background())
	StartConsuming(ctx)
}

func OnStop() {
	cancel() //发出退出信号
	StopConsuming()
}
